# Unlimited Fuel System v1.2.1 (HUD FIX)
### by Izzy86

A comprehensive fuel management system for GTA V with a fully customizable speedometer HUD, realistic refueling, and immersive driving experience.

---

## 🚗 Features

- **Realistic Fuel Consumption** — Vehicles consume fuel based on driving behavior. Run out of gas and you're stranded!
- **Immersive Refueling** — Mark gas station pumps, grab the nozzle, attach it to your vehicle, and watch it fill up in real-time
- **Custom Speedometer HUD** — 9 dial styles from classic blue to sporty eagle, plus a fuel-bar-only mode
- **Station Attendant** — Optional NPC attendant that handles refueling for you
- **Engine Stalling** — Low fuel causes realistic engine stutter and stalling
- **Configurable Alerts** — Audio and visual warnings when fuel is low
- **Full Controller Support** — Navigate all menus with gamepad
- **Menu Font Size** — Adjustable menu text scale for any screen resolution

---

## 📦 Installation

### Easy Install (Recommended)
1. **Run `INSTALL.bat`** — It auto-detects your GTA V folder
2. Your existing settings are **preserved** (not overwritten)
3. Press **INSERT** in-game to open the menu

### Manual Install
1. Copy `FuelAndNozzle.asi` → your GTA V root folder
2. Copy the entire `FuelAndNozzle\` folder → your GTA V root folder
3. **Do NOT overwrite** your existing `FuelAndNozzle.ini` if you want to keep saved pump locations and settings

### Requirements
- [ScriptHookV](http://www.dev-c.com/gtav/scripthookv/) (ASI Loader)
- GTA V (latest version supported)

---

## 🆕 What's New in v1.2.1 (HUD FIX)

### Bug Fixes
- **Fixed Fatal Error crash** — Array overflow (`lfTexDialStyle[8]` on an 8-element array) caused crash on startup when Style 7/8 textures were loaded
- **Fixed HUD style not saving** — Preset loading (`LoadFromPreset`) was overriding the user's saved DialStyle on every game start. HUD Options are now re-applied from the main INI after preset load
- **Fixed main menu wrap bug** — Menu modulo was set to 8 but only 6 items existed, causing Up/Down navigation to scroll through invisible items
- **Fixed HUD position controls not working** — `mainX`/`mainY` were not including `hudOffsetX`/`hudOffsetY`, so the L/R position adjustments had no visual effect
- **Fixed fuel bar color not changing** — D-Shape vertical fuel bar was using hardcoded dynamic color instead of respecting the `barColorIdx` setting from the menu
- **Fixed blip color names mismatch** — Map blip color names didn't match actual GTA V colors (GTA color ID 4 = White, not Yellow). Now uses a proper lookup table mapping each name to its correct GTA V native color ID
- **Fixed needle oversized on Eagle/Luxury styles** — Generated needle textures had wrong dimensions. Reverted to using `NeedleBigA.png` for all styles (properly sized)
- **Fixed Style 9 (Fuel Only) showing needle** — Added `fuelOnly` check to skip needle rendering when fuel-bar-only mode is selected
- **Fixed radio text position** — Lowered radio station text (`RADIO_OFF_Y` from 0.950 to 1.100) to fit in the designated empty zone on new dial designs
- **Fixed Page 6 (HUD Options) modulo** — Font Size option was unreachable because modulo was 6 instead of 7
- **Fixed missing texture loads** — `NeedleEagle.png` was declared but never loaded in `LoadHudTextures()`
- **Fixed game exit hang (Amy mod)** — Replaced deprecated `wmic` process cleanup with fast `taskkill` command + 2-second timeout in `OnAborted`

### New Features
- **HUD Options submenu** — Dedicated page in Misc menu with:
  - Speedometer ON/OFF
  - HUD Style selector (Classic / Luxury Gold / Eagle Sport / Fuel Only)
  - HUD Position X/Y adjustment
  - Move Speed control (numeric)
  - Font Size control (0.22 – 0.34 range, safe limits)
- **Instant save on all changes** — Every setting change (blip color, bar color, HUD style, position, font) now calls `SaveAllSettings()` immediately, so changes persist even if the game crashes
- **3 new dial styles** — Luxury Gold (#7), Eagle Sport with "Izzy86" branding (#8), Fuel Bar Only (#9)

### Style Gallery
| # | Style | Description |
|---|---|---|
| 0-5 | Classic Blue/Red/Gold/Green/Circle/Carbon | Original styles from v1.2 |
| 6 | D-Shape | Flat-left curved-right speedometer |
| 7 | Luxury Gold | Premium gold trim with elegant numerals |
| 8 | Eagle Sport | Aggressive design with eagle emblem and "Izzy86" logo |
| 9 | Fuel Only | Minimal fuel bar gauge, no speedometer dial or needle |

---

## ⌨️ Controls

| Key | Action |
|---|---|
| **INSERT** | Open/Close menu |
| **Up/Down** | Navigate menu items |
| **Left/Right** | Change values |
| **Enter** | Toggle / Select |
| **Backspace** | Go back |
| **E** | Grab/Attach nozzle (near pump) |
| **Q** | Mark pump location |

---

## 📁 File Structure

```
GTA V Root/
├── FuelAndNozzle.asi          ← Main mod (ASI plugin)
├── FuelAndNozzle.ini          ← Saved settings (auto-generated)
└── FuelAndNozzle/
    ├── settings.ini           ← Fuel/refuel configuration
    ├── UFS_Style0_Blue.png    ← Dial textures (Styles 0-8)
    ├── ...
    ├── NeedleBigA.png         ← Speed needle
    ├── MenuHeader.png         ← Banner themes (Night/Day/Dusk)
    ├── white_bar.png          ← Fuel bar texture
    └── FuelAlert1.wav         ← Low fuel warning sound
```

---

## 🔧 Compatibility

- Works alongside other ScriptHookV mods
- Does not conflict with LemonUI or NativeUI menus (uses custom overlay)
- Compatible with LSPDFR, Menyoo, and other popular mods
- Supports GTA V latest version with ScriptHookV

---

**Created by Izzy86** | v1.2.1 HUD FIX | 2026
